package com.wangshb.upms.controller;


import com.wangshb.upms.dto.login.LoginRequestDto;
import com.wangshb.upms.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;


    @PostMapping(value = "/login")
    public void login(@RequestBody LoginRequestDto loginRequestDto) {
        loginService.login(loginRequestDto.getUserName(), loginRequestDto.getPassword());
    }


    @PostMapping(value = "/sayHello")
    public Map<String, Object> sayHello(@RequestBody String username) {
        return new HashMap<String, Object>(){{
            this.put("username", username);
        }};
    }
}
